// 请求地址
const BASE_URL = "https://goods.zzgoodqc.cn"

class KiRequest {

	request(url, method, data) {
		return new Promise((resolve, reject) => {
			wx.request({
				url: BASE_URL + url,
				method: method,
				data: data,
				success: function(res) {
					resolve(res.data)
				},
				fail: function(err) {
					reject(err)
				}
			})
		})
	}

	get(url, params) {
		return this.request(url, "GET", params)
	}

	post(url, data) {
		return this.request(url, "POST", data)
	}
}

const kiRequest = new KiRequest();

export default kiRequest
